/*
 *  Copyright 2011 yura.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *  under the License.
 */
package org.opu.pc.ui.client.actions;

import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.net.URL;
import javax.swing.JDialog;
import javax.swing.JEditorPane;
import javax.swing.JScrollPane;
import org.opu.pc.ui.util.GUIUtils;

/**
 *
 * @author yura
 */
public class License extends AbstractAction {

    public static final String CLASS_PATH_URL = "/META-INF/LICENSE";
    public static final URL CLASS_PATH = License.class.getResource(CLASS_PATH_URL);
	private static final long serialVersionUID = -4842027323109046145L;
	
    @Override
    public String getName() {
        return "License";
    }

    @Override
    public void runAction(ActionEvent e) throws Exception {
        JDialog dialog = mainView.getDialog();
        dialog.setTitle(getDialogTitle());
        JEditorPane pane = GUIUtils.addActions(new JEditorPane(CLASS_PATH));
        pane.setEditable(false);
        pane.setBackground(Color.WHITE);
        pane.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 14));
        dialog.getContentPane().add(new JScrollPane(pane));
        dialog.setSize(680, 640);
        dialog.setLocationRelativeTo(null);
        dialog.setVisible(true);
    }

}
